package com.dhcc.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author liuguoting
 */
@ConfigurationProperties(prefix = "spring.redis")
public class RedisProperties {
    private String host;
    private int port;
    private String password;
    private int database;
    private PoolOptions pool = new PoolOptions();

    public String getHost() {
        return host;
    }

    public RedisProperties setHost(String host) {
        this.host = host;
        return this;
    }

    public int getPort() {
        return port;
    }

    public RedisProperties setPort(int port) {
        this.port = port;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public RedisProperties setPassword(String password) {
        this.password = password;
        return this;
    }

    public int getDatabase() {
        return database;
    }

    public RedisProperties setDatabase(int database) {
        this.database = database;
        return this;
    }

    public PoolOptions getPool() {
        return pool;
    }

    public void setPool(PoolOptions pool) {
        this.pool = pool;
    }

    public static class PoolOptions {
        private Integer maxActive;
        private Integer maxIdle;
        private Integer minIdle;
        private Integer maxWait;

        // Getter and Setter
        public Integer getMaxActive() {
            return maxActive;
        }

        public void setMaxActive(Integer maxActive) {
            this.maxActive = maxActive;
        }

        public Integer getMaxIdle() {
            return maxIdle;
        }

        public void setMaxIdle(Integer maxIdle) {
            this.maxIdle = maxIdle;
        }

        public Integer getMinIdle() {
            return minIdle;
        }

        public void setMinIdle(Integer minIdle) {
            this.minIdle = minIdle;
        }

        public Integer getMaxWait() {
            return maxWait;
        }

        public void setMaxWait(Integer maxWait) {
            this.maxWait = maxWait;
        }
    }
}
